package com.text.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.text.dao.GoodsDao;
import com.text.entity.Goods;
import com.text.service.GoodsService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class GoodsServiceImpl implements GoodsService {
    @Resource
    GoodsDao goodsDao;
//    @Override
//    public ArrayList<Goods> getGoodsList() {
//        return goodsDao.getGoodsList();
//    }

    @Override
    public PageInfo<Goods> queryAllByPage(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        ArrayList<Goods> goods = goodsDao.getGoodsList();
        PageInfo<Goods> pageInfo = new PageInfo<>(goods);
        return pageInfo;
    }

    @Override
    public int deleteById(Integer id) {
        return this.goodsDao.deleteById(id) ;
    }

    @Override
    public int insert(Goods goods) {
        int num = this.goodsDao.insert(goods);
        return num;
    }
    @Override
    public Goods hyqqueryById(Integer id) {
        return this.goodsDao.hyqById(id);
    }

    @Override
    public int hyqupdate(Goods edit) {
        return this.goodsDao.hyqUpDate(edit);
    }

}
